<!DOCTYPE html>
<!-- saved from url=(0041)http://www.novaecs.com:8090/register.html -->
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=1140px, initial-scale=1">
    <title>注册</title>

    <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link id="bootcss" rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">
    
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
        <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        body{font-family: 'microsoft yahei';min-width:1140px;}
        .jumbotron{color:#fff;background-image: linear-gradient(to bottom,#563d7c 0,#6f5499 100%)}
        .jumbotron input{color:#444;width:300px;}
        .lab-lg{margin:0 auto 30px;display:block;text-align:center;width:144px;height:144px;line-height: 140px;font-size:108px;background-color: transparent;border: solid 1px #fff;border-radius: 15%;}
        .margin{display:block;height:50px;width:100%;}
        #box-tip{display:none; background-color: #EBFB58;}
        .help-block{color:#f00;display:none;}
        .glyphicon{display:none;}
        .requied{color:#f00;}
        .stepbar{margin:0 auto;}
    </style>
    <!--[if IE]>
        <style>
            .jumbotron{background-color: #563d7c;}
            button{width:60px;margin:10px;}
        </style>
    <![endif]-->
<style type="text/css" adt="123"></style><script type="text/javascript" src="${base}/plugins/loadArea.js"></script><script type="text/javascript" src="${base}/plugins/nova.js"></script></head>
<body>
    <nav class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="container">
            <div class="collapse navbar-collapse">
                <a class="navbar-brand" href="/" style="color:#057bc2;font-size:25px;">
                    首页
                </a>
                <span class="navbar-brand">&gt;</span>
                <span class="navbar-brand">用户注册</span>
            </div>
        </div>
    </nav>
    <div class="container">
        <div class="jumbotron">
            <h1>欢迎注册物联网空气系统</h1>
            <a class="btn btn-primary btn-lg hide" href="http://www.novaecs.com:8090/jsp/login.jsp">返回登录</a>
<!--        <span class='lab-lg'>N</span>
            <h1>注册</h1>
            <p>请输入您设备上的SN号，进行验证</p>
            <p><input id='ip-sn' type='text'/><span> </span><a class="btn btn-primary btn-lg btn-check" role="button" onclick='clk_checkSN()'>验证</a></p>
-->
        </div>

        <div id="box-tip" class="alert alert-warning alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
            <strong>提示: </strong> <b id="tip"></b>
        </div>
        <div id="step1" style="display: none;">
            <div class="stepbar row">
                
            </div>
            <h4 class="text-center">请填入您的验证信息(带<span class="requied">*</span>为必填项)</h4>
            <form class="form-horizontal" role="form" action="http://www.novaecs.com:8090/register.html#" type="post" onsubmit="return register();" '="">
                <div class="form-group has-feedback">
                    <label for="ip-sn" class="col-xs-3 col-sm-6 col-md-3 control-label">SN<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="email" class="form-control" id="ip-sn" placeholder="SN(XXXX-XXXX)" onchange="checkSN(this)">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">无效的SN</span>
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <label for="ip-key" class="col-xs-3 col-sm-3 col-md-3 control-label">KEY<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="text" class="form-control" id="ip-key" placeholder="KEY" onchange="checkKey(this)">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">无效的KEY</span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-xs-offset-3 col-md-offset-3 col-xs-2">
                        <a type="button" class="btn btn-primary" href="http://www.novaecs.com:8090/register.html#" style="width:120px;" onclick="clk_step2();">下一步</a>
                    </div>
                    <div class="col-xs-offset-2 col-md-offset-2 col-xs-2">
                        <a type="button" class="btn btn-default" href="http://www.novaecs.com:8090/jsp/login.jsp" style="width:120px;">返回登录</a>
                    </div>
                </div>
            </form>
        </div>
        <div id="step2">
            <h4 class="text-center">请填入您的注册信息(带<span class="requied">*</span>为必填项)</h4>
            <form class="form-horizontal" role="form" action="http://www.novaecs.com:8090/register.html#" type="post" onsubmit="return register();" '="">
                <div class="form-group has-feedback">
                    <label for="ip-email" class="col-xs-3 col-sm-3 col-md-3 control-label">Email<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="email" class="form-control" id="ip-email" placeholder="Email" onchange="checkEmail(this)">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">email已被使用</span>
                        <span class="help-block">请填写正确的email</span>
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <label for="ip-usernm" class="col-xs-3 col-sm-3 col-md-3 control-label">用户名<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="text" class="form-control" id="ip-usernm" placeholder="用户名" onchange="checkUsernm(this)">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">用户名已被使用</span>
                        <span class="help-block">用户名只能是字母数字或下划线，且不能为空</span>
                    </div>
                </div>
                <div class="form-group">
                    <label for="ip-pwd" class="col-xs-3 col-sm-3 col-md-3 control-label">密码<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="password" class="form-control" id="ip-pwd" placeholder="密码">
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <label for="ip-pwd2" class="col-xs-3 col-sm-3 col-md-3 control-label">再次输入密码<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="password" class="form-control" id="ip-pwd2" placeholder="再次输入密码" onchange="checkPwd(this)">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">两次密码不一致</span>
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <!--<label for="ip-city" class="col-xs-3 col-sm-3 col-md-3 control-label">城市</label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="text" class="form-control" id="ip-city" onblur='checkCity(this)' placeholder="您所在城市,比如北京，上海"/>
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">请输入正确的城市名</span>
                    </div>-->
                    <label class="col-xs-3 col-sm-3 col-md-3 control-label">地区<span class="requied">*</span></label>
                    <div class="col-sm-1 col-xs-3 col-md-1">
                        <button id="province" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span data="value" class="hide"></span><span data="show">省</span> <span class="caret"></span>
                        </button>
                        <ul id="ul-province" class="dropdown-menu" role="menu"><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">北京</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">上海</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">天津</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">重庆</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">香港</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">澳门</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">台湾</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">黑龙江</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">吉林</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">辽宁</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">内蒙古</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">河北</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">河南</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">山西</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">山东</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">江苏</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">浙江</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">福建</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">江西</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">安徽</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">湖北</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">湖南</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">广东</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">广西</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">海南</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">贵州</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">云南</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">四川</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">西藏</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">陕西</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">宁夏</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">甘肃</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">青海</a></li><li onclick="clk_province(this)"><span data="value" class="hide">undefined</span><a href="javascript:void(0);" data="show">新疆</a></li></ul>
                    </div>
                    <div class="col-sm-1 col-xs-1 col-md-1">
                        <button id="city" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span data="value" class="hide"></span><span data="show">市</span> <span class="caret"></span>
                        </button>
                        <ul id="ul-city" class="dropdown-menu" role="menu">
                        
                        </ul>
                    </div>
                    <div class="col-sm-1 col-xs-1 col-md-1">
                        <button id="county" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span data="value" class="hide"></span><span data="show">区</span> <span class="caret"></span>
                        </button>
                        <ul id="ul-county" class="dropdown-menu" role="menu">
                            
                        </ul>
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="col-xs-3 col-sm-3 col-md-3 control-label">用户类别<span class="requied">*</span></label>
                    <div class="col-sm-1 col-xs-1 col-md-1">
                        <button id="role" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            <span data="value" class="hide">consumer</span><span data="show">普通用户</span> <span class="caret"></span>
                        </button>
                        <ul id="ul-role" class="dropdown-menu" role="menu">
                            <li><span data="value" class="hide">consumer</span><a data="show">普通用户</a></li>
                            <li><span data="value" class="hide">seller</span><a data="show">经销商</a></li>
                            <li><span data="value" class="hide">vip</span><a data="show">顶级用户</a></li>
                        </ul>
                    </div>
                </div>
                <div class="form-group has-feedback">
                    <label for="ip-phone" class="col-xs-3 col-sm-3 col-md-3 control-label">手机<span class="requied">*</span></label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <input type="tel" class="form-control" id="ip-phone" oninput="checkPhone(this)" placeholder="输入手机号以便为您提供更好的个性化服务">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">请输入11位手机号</span>
                    </div>
                </div>
                <div class="form-group has-feedback hide">
                    <label for="ip-father" class="col-xs-3 col-sm-3 col-md-3 control-label">上级用户</label>
                    <div class="col-xs-6 col-sm-6 col-md-6">
                        <span id="fid" class="hide" data="fid">0</span>
                        <input type="text" class="form-control" id="ip-father" onchange="checkFather(this)" placeholder="您的上级用户的用户名">
                        <span class="glyphicon glyphicon-ok form-control-feedback"></span>
                        <span class="glyphicon glyphicon-warning-sign form-control-feedback"></span>
                        <span class="help-block">此用户不存在，请联系您的经销商确保上级用户名正确</span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-xs-offset-3 col-md-offset-3 col-xs-2">
                        <a type="button" class="btn btn-primary" href="http://www.novaecs.com:8090/register.html#" style="width:120px;" onclick="register();">注册</a>
                    </div>
                    <div class="col-xs-offset-2 col-md-offset-2 col-xs-2">
                        <a type="button" class="btn btn-default" href="http://www.novaecs.com:8090/jsp/login.jsp" style="width:120px;">返回登陆</a>
                    </div>
                </div>
            </form>
        </div>
        <div id="dlg-tip" class="modal fade">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title">提示</h4>
                    </div>
                    <div class="modal-body">
                        <div class="container">
                            <p>您已注册成功</p>
                            <p>请牢记您的用户名和密码，返回登录!</p>
                            <p>用户名：<span id="dlg-tip-username"></span></p>
                            <p>密码：<span id="dlg-tip-pwd"></span></p>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <a type="button" class="btn btn-primary" href="">确认</a>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </div>

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script id="jquery" type="text/javascript" language="JavaScript" src="${base}/plugins/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script id="boot" type="text/javascript" src="${base}/plugins/bootstrap.min.js"></script>
    <script type="text/javascript" src="${base}/plugins/loadScripts.js"></script>
    <script type="text/javascript">
        var SN;
        var info;
        var area;
        loadJSById('jquery','${base}/plugins/jquery-1.10.2.js');
      //  loadCSSById('bootcss','${base}/plugins/bootstrapt.min.css');
        loadJSById('boot','${base}/plugins/bootstrap.min.js');
        loadJS('${base}/plugins/loadArea.js',function(){
            loadJS('${base}/plugins/nova.js',init);
        });
        function init(){
            $(document).ready(function(){
                $(".dropdown-menu li").click(function(){
                    var btn = $(this).parents("ul.dropdown-menu").prev(".dropdown-toggle");
                    $(btn).find("span[data='value']").text($(this).find("span[data='value']").text());
                    $(btn).find("span[data='show']").text($(this).find("a[data='show']").text());
                });
                findProvinces();
            });
        }
        function checkSN(ip) {
            var sn = $(ip).val();
            if (sn!="") {
                $.ajax({
                    type:'post',
                    url:'/api/svc/snIndex.php',
                    data:{fun:'checkSN',sn:sn},
                    success:function(r){
                        if (r && r.status=='ok') {
                            $(ip).nextAll(".glyphicon-ok").show();
                            $(ip).nextAll(".help-block").hide();
                        }else{
                            $(ip).nextAll(".glyphicon-ok").hide();
                            $(ip).nextAll(".help-block").show();
                        }
                    }
                });
            }
        }
        function checkKey(ip) {
            var sn = $("#ip-sn").val();
            var key = $(ip).val();
            if (sn!="" && key!="") {
                $.ajax({
                    type:'post',
                    url:'/api/svc/snIndex.php',
                    data:{fun:'checkKey',sn:sn,key:key},
                    success:function(r){
                        if (r && r.status=='ok') {
                            $(ip).nextAll(".glyphicon-ok").show();
                            $(ip).nextAll(".help-block").hide();
                        }else{
                            $(ip).nextAll(".glyphicon-ok").hide();
                            $(ip).nextAll(".help-block").show();
                        }
                    }
                });
            }else{
                showTip("SN 和 KEY 均不能为空");
            }
        }
        function clk_step2(){
            var sn = $("#ip-sn").val();
            var key = $("#ip-key").val();
            if (!sn || !key) {
                showTip("请输入sn和key");
            }else if ($(".help-block:visible").length>0) {
                showTip("有不正确的输入,请查看表单中的提示信息");
            }else{
                $("#step1").hide();
                $("#step2").show();
            }
        }
        function checkFather(ip) {
            var um = $(ip).val();
            if (um && um.length>0) {
                $.ajax({
                    type:'post',
                    url:'/api/svc/userIndex.php',
                    data:{fun:'registerUsername',username:um},
                    success:function(r){
                        if (r && r.status=='ok') {
                            $(ip).nextAll(".glyphicon-ok").hide();
                            $(ip).nextAll(".help-block").show();
                        }else{
                            $(ip).nextAll(".glyphicon-ok").show();
                            $(ip).nextAll(".help-block").hide();
                            if (r.result) {
                                $(ip).prevAll("span[data='fid']").text(r.result.id);
                            }
                        }
                    }
                });
            }
        }
        function checkEmail(ip){
            $(ip).nextAll(".help-block").hide();
            var eml = $(ip).val();
            if (!nova_check_email(eml)) {
                $(ip).nextAll(".help-block:eq(1)").show();
                return;
            }else{
                $(ip).nextAll(".help-block:eq(1)").hide();
            }
            if (eml && eml.length>0) {
                $.ajax({
                    type:'post',
                    url:'/api/svc/userIndex.php',
                    data:{fun:'registerEmail',email:eml},
                    success:function(r){
                        if (r && r.status=='ok') {
                            $(ip).nextAll(".glyphicon-ok").show();
                            $(ip).nextAll(".help-block:eq(0)").hide();
                        }else{
                            $(ip).nextAll(".glyphicon-ok").hide();
                            $(ip).nextAll(".help-block:eq(0)").show();
                        }
                    }
                });
            }
        }
        function checkPhone(ip){
            $(ip).nextAll(".help-block").hide();
            var eml = $(ip).val();
            if (!nova_check_phone(eml)) {
                $(ip).nextAll(".glyphicon-ok").hide();
                $(ip).nextAll(".help-block:eq(0)").show();
            }else{
                $(ip).nextAll(".glyphicon-ok").show();
                $(ip).nextAll(".help-block:eq(0)").hide();
            }
        }
        function checkUsernm(ip){
            $(ip).nextAll(".help-block").hide();
            $(ip).nextAll(".glyphicon-ok").hide();
            var um = $(ip).val();
            if (!nova_check_username(um)) {
                $(ip).nextAll(".help-block:eq(1)").show();
                return;
            }else{
                $(ip).nextAll(".help-block:eq(1)").hide();
            }
            if (um && um.length>0) {
                $.ajax({
                    type:'post',
                    url:'/api/svc/userIndex.php',
                    data:{fun:'registerUsername',username:um},
                    success:function(r){
                        if (r && r.status=='ok') {
                            $(ip).nextAll(".glyphicon-ok").show();
                            $(ip).nextAll(".help-block:eq(0)").hide();
                        }else{
                            $(ip).nextAll(".glyphicon-ok").hide();
                            $(ip).nextAll(".help-block:eq(0)").show();
                        }
                    }
                });
            }
        }
        function checkPwd(ip){
            if ($("#ip-pwd2").val()!=$("#ip-pwd").val()) {
                $(ip).nextAll(".help-block").show();
                $(ip).nextAll(".glyphicon-ok").hide();
            }else if($(ip).val()!=''){
                $(ip).nextAll(".glyphicon-ok").show();
                $(ip).nextAll(".help-block").hide();
            }else{
                $(ip).nextAll(".glyphicon-ok").hide();
                $(ip).nextAll(".help-block").hide();
            }
        }
        function register(){
            var ret = false;
            if ($(".help-block:visible").length>0) {
                showTip("有不正确的输入,请查看表单中的提示信息");
                return ret;
            }
            var sn = $("#ip-sn").val();
            var key = $("#ip-key").val();
            var u = $("#ip-usernm").val();
            var pwd = $("#ip-pwd").val();
            var pwd2 = $("#ip-pwd2").val();
            var eml = $("#ip-email").val();
            var phone = $("#ip-phone").val();
            var father = $('#ip-father').val();
            var areaId=$("#county span[data='value']").text();
            var role=$("#role span[data='value']").text();
            if (role=='') {
                role="consumer";
            }
            if (eml=='') {
                showTip("请输入您的注册邮箱");
            }else if (u=='') {
                showTip("请输入您的用户名");
            }else if (pwd=='') {
                showTip("请输入您的密码");
            }else if (pwd!=pwd2) {
                showTip("两次密码输入不一致");
            }else if (areaId=='') {
                showTip("请选择地区");
            }else if (phone=='') {
                showTip("请输入手机号");
            }else{
                $.ajax({
                    type:'post',
                    url:'/api/svc/userIndex.php',
                    data:{fun:'register',username:u,pwd:pwd,email:eml,phone:phone,areaid:areaId,father:father,role:role},
                    success:function(r){
                        if (r.status=='ok') {
                            //window.location.href='/jsp/home.jsp';
                            ret = true;
                            showTip("注册成功,现在您可以使用您的注册信息返回登录");
                            $.ajax({
                                type:'post',
                                url:'/api/svc/snIndex.php',
                                data:{fun:"useSN",sn:sn,key:key,username:u},
                                success:function(r){
                                    //alert(r.tid);
                                }
                            });
                            $("#dlg-tip-username").text(u);
                            $("#dlg-tip-pwd").text(pwd);
                            $("#dlg-tip").modal('show');
                        }else{
                            showTip("提交失败，失败信息:"+r.reason);
                        }
                    }
                });
            }
            return ret;
        }
        function showTip(msg){
            $("#tip").text(msg);
            $("#box-tip").show();
            setTimeout(function(){$("#box-tip").hide();},10000);
        }
    </script>

</body></html>